const saveBase64Image = function (data) {
  return new Promise((resovle, reject) => {
    const fileManager = wx.getFileSystemManager();
    const filePath = wx.env.USER_DATA_PATH + "/" + new Date().getTime() + ".png";
    //先存储一个临时文件
    fileManager.writeFile({
      filePath: filePath,
      data: data.substring(22),
      encoding: "base64",
      success: res => {
        resovle(filePath);
      },
      fail: err => {
        reject(err);
      }
    });
  });
}

export default {
  saveBase64Image
}